<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "{{%part}}".
 *
 * @property integer $uid
 * @property integer $fid
 */
class Part extends \yii\db\ActiveRecord
{
    public static function tableName()
    {
        return 'part';
//        return 'mdsparts';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title', 'part_number', 'manufacturer_number', 'list_price', 'universal_part', 'brand_title', 'brand_id', 'description', 'fits', 'specifications_json', 'Quantity_Sold', 'Product_Fit', 'Warranty', 'Color_Finish', 'Material', 'Location', 'Series', 'Notes', 'Seat_Type', 'Fit_Note', 'Design', 'Position', 'Type', 'Row', 'Recommended_Use', 'Vehicle_Body_Type', 'Construction', 'Kit_Type'], 'required'],
            [['universal_part', 'brand_id'], 'integer'],
            [['description', 'fits', 'specifications_json', 'Notes', 'Fit_Note'], 'string'],
            [['title', 'part_number', 'manufacturer_number', 'list_price', 'brand_title', 'Quantity_Sold', 'Product_Fit', 'Warranty', 'Color_Finish', 'Material', 'Location', 'Series', 'Seat_Type', 'Design', 'Position', 'Type', 'Row', 'Recommended_Use', 'Vehicle_Body_Type', 'Construction', 'Kit_Type'], 'string', 'max' => 255],
            [['title', 'part_number', 'manufacturer_number', 'list_price'], 'unique', 'targetAttribute' => ['title', 'part_number', 'manufacturer_number', 'list_price'], 'message' => 'The combination of Title, Part Number, Manufacturer Number and List Price has already been taken.'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => 'Title',
            'part_number' => 'Part Number',
            'manufacturer_number' => 'Manufacturer Number',
            'list_price' => 'List Price',
            'universal_part' => 'Universal Part',
            'brand_title' => 'Brand Title',
            'brand_id' => 'Brand ID',
            'description' => 'Description',
            'fits' => 'Fits',
            'specifications_json' => 'Specifications Json',
            'Quantity_Sold' => 'Quantity  Sold',
            'Product_Fit' => 'Product  Fit',
            'Warranty' => 'Warranty',
            'Color_Finish' => 'Color  Finish',
            'Material' => 'Material',
            'Location' => 'Location',
            'Series' => 'Series',
            'Notes' => 'Notes',
            'Seat_Type' => 'Seat  Type',
            'Fit_Note' => 'Fit  Note',
            'Design' => 'Design',
            'Position' => 'Position',
            'Type' => 'Type',
            'Row' => 'Row',
            'Recommended_Use' => 'Recommended  Use',
            'Vehicle_Body_Type' => 'Vehicle  Body  Type',
            'Construction' => 'Construction',
            'Kit_Type' => 'Kit  Type',
        ];
    }

}
